from building import *

cwd = GetCurrentDir()

src = []

if GetDepend('BSP_USING_GPIO'):
    src += ['drv_gpio.c']

if GetDepend('BSP_USING_SPI'):
    src += [ 'drv_spi.c']

if GetDepend(['RT_USING_QSPI']):
    src += ['drv_qspi.c']    

if GetDepend('BSP_USING_I2C'):
    src += [ 'drv_i2c.c']

if GetDepend('BSP_USING_RTC'):
    src += ['drv_rtc.c']

if GetDepend('BSP_USING_WDG'):
    src += ['drv_wdt.c']

if GetDepend('BSP_USING_EWDG'):
    src += ['drv_ewdt.c']

if GetDepend('BSP_USING_ETH'):
    src += ['drv_enet.c']
    src += ['drv_enet_phy.c']

if GetDepend('BSP_USING_SDXC'):
    src += ['drv_sdio.c']

if GetDepend('BSP_USING_PWM') or GetDepend('BSP_USING_PWMV2'):
    src += ['drv_pwm.c']

if GetDepend('BSP_USING_GPTMR'):
    src += ['drv_hwtimer.c']

if GetDepend('BSP_USING_CAN'):
    src += ['drv_can.c']

if GetDepend('BSP_USING_MCAN'):
    src += ['drv_mcan.c']

if GetDepend('BSP_USING_UART'):
    if GetDepend(['RT_USING_SERIAL_V2']):
        src += ['drv_uart_v2.c']
    else:
        src += ['drv_uart.c']

if GetDepend('BSP_USING_ADC'):
    src += ['drv_adc.c']

# if GetDepend('BSP_USING_USB_HOST'):
#     src += ['drv_usb.c']

if GetDepend('BSP_USING_DAO'):
    src += ['drv_dao.c']

if GetDepend('BSP_USING_PDM'):
    src += ['drv_pdm.c']

if GetDepend('BSP_USING_I2S'):
    src += ['drv_i2s.c']

if GetDepend('BSP_USING_MCAN'):
    src += ['drv_mcan.c']

if GetDepend(['BSP_USING_RTT_LCD_DRIVER']):
    src += ['drv_lcd.c']

path = [cwd]

group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)

Return('group')
